
/**
 * primitive Point 大量加载
 * 
 */
import Primitive from "../Primitive"

const DEFAULT_STYLE = {
  color: Cesium.Color.SKYBLUE, // default: WHITE
  pixelSize: 10, // default: 1
  outlineColor: Cesium.Color.YELLOW, // default: TRANSPARENT
  outlineWidth: 3, // default: 0
  show: true
}

export default class PointPrimitive extends Primitive {
  /**
   * @param {*} positions 
   * @param {*} options 
   */
  constructor(positions, options = {}) {
    super()
    this._positions = positions
    this._type = 'point_primitive'
    this._style = {
      ...DEFAULT_STYLE,
      ...options
    }
    this.delegate = {}
    this.mounted()
  }

  /**
   * 属性初始化
   */
  mounted() {
    this.positions = this._positions
    this.style = this._style
  }

  /**
   * 
   * @param {*} style 
   * @returns 
   */

  setStyle(style) {
    if (!style) return
    Object.assign(this._style, { ...style })
    Object.assign(this.delegate, {
      ...this._style
    })
  }

  get positions() {
    return this._positions
  }

  set positions(val) {
    this._positions = val
    this.delegate.position = this._positions
  }
}
